<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../assets/css/layui.css" />
		<script src="../assets/layui.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../js/bootstarp-3.3.7/css/bootstrap.min.css" />
		<script src="../js/jquery/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../js/bootstarp-table-1.11.1/bootstrap-table.min.css" />
		<script src="../js/bootstarp-table-1.11.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>

	</head>
	<script>
		$(function() { //, headers: { 'x-requested-with': 'XMLHttpRequest' }
			$.ajaxSetup({
				crossDomain: true,
				xhrFields: {
					withCredentials: true
				}
			});
		});
	</script>

	<script type="text/javascript">
		layui.use('element', function() {
			var $ = layui.jquery,
				element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		})

		$(function() {

			$("#btn").click(function() {

				$("#ghlb").bootstrapTable('refresh')
			})

			$("#btn2").click(function() {
				$("#hzk").bootstrapTable('refresh')

			})

			$("#ghlb").bootstrapTable({
				url: "http://localhost:8091/nw/queryPatient", 
				pagination: true, 
				pageSize: 6,
				queryParams: queryParams,
				columns: [{
						field: 'name',
						title: '患者姓名',
						align: 'center',
					}, {
						field: 'sex',
						title: '性别',
						align: 'center',
						formatter:function(value,data){
		                       if(value=="1"){
			                      return "男" ;
		                       }if(value=="2"){
			                      return "女" ;
		                       }
		              } 
					}, {
						field: 'age',
						title: '年龄(周岁)',
						align: 'center',
					},{
						field: 'create_time',
						title: '挂号时间',
						align: 'center',
					}, {
						title: '操作',
						align: 'center',
						formatter: function(value, row, index) {
							return '<button onclick="chooseGhlb(' + row.patient_id + ')" class="btn btn-info glyphicon glyphicon-ok-circle">导入</button>'
						}
					}
				]
			})
		})
		function chooseGhlb(id) {
			parent.$("#hzid").val(id)
//			parent.$("#ghid").val(regid)
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
			
		}

		function queryParams(Params) {

			return {
				'name': $("#name").val()

			}
		}
	</script>
	<body>
		<div class="layui-tab layui-tab-card">
			
			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show" align="center">
					<form class="form-inline">
						<label for="exampleInputName2">患者姓名：</label>
						<input type="text" class="form-control" name="name" id="name" value="" placeholder="请输入姓名" />
						<button type="button" class="btn btn-primary glyphicon glyphicon-search" id="btn"></button>

					</form>
					<br />
					<div>
						<table id="ghlb"></table>
					</div>
				</div>

				

			</div>
		</div>

	</body>

</html>